package com.concurrence.juc;

import java.util.concurrent.ConcurrentHashMap;

/**
 * ConcurrentHashMapDemo..
 *
 * DEBUG 源码部分
 *
 * @author Lizhong
 * @date 2020/8/13
 */
public class ConcurrentHashMapDemo {

    public static void main(String[] args) {
        final ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
        for (int i = 0; i < 6; i++) {
            concurrentHashMap.put(i,i);
        }
        concurrentHashMap.put(16,16);

        // 1000 0000 0001 1011
         int RESIZE_STAMP_BITS = 16;
         int i = Integer.numberOfLeadingZeros(RESIZE_STAMP_BITS);
        System.out.println(Integer.toBinaryString(i)); //27

         int rs = i | (1 << (16 - 1));
        System.out.println(Integer.toBinaryString(rs));
         int i1 = (rs << 32-RESIZE_STAMP_BITS) + 2;
        System.out.println(i1+ ","+Integer.toBinaryString(i1));
        i1++;
        System.out.println(i1+ ","+Integer.toBinaryString(i1));

    }
}
